package cn.melon.mod.dorm;

import org.json.JSONException;
import org.json.JSONObject;

public class DormInfo {
    private String dormNum;// 宿舍号码
    private String studentNum;// 室友数目
    private String newHonor;// 最新获得荣誉
    private String newScore;// 最新宿舍卫生评分
    private String waterAndEletricityCharge;// 宿舍水电费

    public static DormInfo toInfo(JSONObject jInfo) throws JSONException {
        DormInfo dormInfo = new DormInfo();
        dormInfo.setDormNum(jInfo.getString("dormNum"));
        dormInfo.setStudentNum(jInfo.getString("studentNum"));
        dormInfo.setNewHonor(jInfo.getString("newHonor"));
        dormInfo.setNewScore(jInfo.getString("newScore"));
        dormInfo.setWaterAndEletricityCharge(jInfo.getString("waterAndEletricityCharge"));
        return dormInfo;
    }

    public JSONObject toJSON() throws JSONException {
        JSONObject jInfo = new JSONObject();
        jInfo.put("studentNum", getStudentNum());
        jInfo.put("dormNum", getDormNum());
        jInfo.put("newHonor", getNewHonor());
        jInfo.put("newScore", getNewScore());
        jInfo.put("waterAndEletricityCharge", getWaterAndEletricityCharge());
        return jInfo;
    }

    public DormInfo() {
    }

    public DormInfo(String dormNum, String studentNum, String newHonor, String newScore, String waterAndEletricityCharge) {
        super();
        this.dormNum = dormNum;
        this.studentNum = studentNum;
        this.newHonor = newHonor;
        this.newScore = newScore;
        this.waterAndEletricityCharge = waterAndEletricityCharge;
    }

    public String getDormNum() {
        return dormNum;
    }

    public void setDormNum(String dormNum) {
        this.dormNum = dormNum;
    }

    public String getNewHonor() {
        return newHonor;
    }

    public String getStudentNum() {
        return studentNum;
    }

    public void setStudentNum(String studentNum) {
        this.studentNum = studentNum;
    }

    public void setNewHonor(String newHonor) {
        this.newHonor = newHonor;
    }

    public String getNewScore() {
        return newScore;
    }

    public void setNewScore(String newScore) {
        this.newScore = newScore;
    }

    public String getWaterAndEletricityCharge() {
        return waterAndEletricityCharge;
    }

    public void setWaterAndEletricityCharge(String waterAndEletricityCharge) {
        this.waterAndEletricityCharge = waterAndEletricityCharge;
    }
}
